package com.ruoyi.cmemetal.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cmemetal.mapper.ZxPostProcessMapper;
import com.ruoyi.cmemetal.domain.ZxPostProcess;
import com.ruoyi.cmemetal.service.IZxPostProcessService;

/**
 * postprocessService业务层处理
 *
 * @author ruoyi
 * @date 2022-01-01
 */
@Service
public class ZxPostProcessServiceImpl implements IZxPostProcessService
{
    @Autowired
    private ZxPostProcessMapper zxPostProcessMapper;

    /**
     * 查询postprocess
     *
     * @param id postprocess主键
     * @return postprocess
     */
    @Override
    public ZxPostProcess selectZxPostProcessById(Long id)
    {
        return zxPostProcessMapper.selectZxPostProcessById(id);
    }

    /**
     * 查询postprocess列表
     *
     * @param zxPostProcess postprocess
     * @return postprocess
     */
    @Override
    public List<ZxPostProcess> selectZxPostProcessList(ZxPostProcess zxPostProcess)
    {
        return zxPostProcessMapper.selectZxPostProcessList(zxPostProcess);
    }

    /**
     * 新增postprocess
     *
     * @param zxPostProcess postprocess
     * @return 结果
     */
    @Override
    public int insertZxPostProcess(ZxPostProcess zxPostProcess)
    {
        return zxPostProcessMapper.insertZxPostProcess(zxPostProcess);
    }

    /**
     * 修改postprocess
     *
     * @param zxPostProcess postprocess
     * @return 结果
     */
    @Override
    public int updateZxPostProcess(ZxPostProcess zxPostProcess)
    {

        //修改后处理时长
        if(zxPostProcess.getOverTime() != null && zxPostProcess.getStartTime() != null){

        }
        long time = DateUtils.zxgetDatePoor(zxPostProcess.getOverTime(), zxPostProcess.getStartTime());
        zxPostProcess.setPostProcessTime(time);

        return zxPostProcessMapper.updateZxPostProcess(zxPostProcess);
    }

    /**
     * 批量删除postprocess
     *
     * @param ids 需要删除的postprocess主键
     * @return 结果
     */
    @Override
    public int deleteZxPostProcessByIds(Long[] ids)
    {
        return zxPostProcessMapper.deleteZxPostProcessByIds(ids);
    }

    /**
     * 删除postprocess信息
     *
     * @param id postprocess主键
     * @return 结果
     */
    @Override
    public int deleteZxPostProcessById(Long id)
    {
        return zxPostProcessMapper.deleteZxPostProcessById(id);
    }
}
